// Simple platform independent rectangle definition.
// Copyright 2005 (C) Ralph Thomas

#ifndef VIEW_RECTANGLE_H
#define VIEW_RECTANGLE_H

#include <iostream>

namespace view {
	//
	/// This rectangle structure is used by generic implementations (such as generator)
	/// to communicate with other widget implementations. This is easier than using
	/// a platform specific structure.
	//
	struct rectangle {
		long x;
		long y;
		long w;
		long h;
		rectangle() : x( 0 ), y( 0 ), w( 0 ), h( 0 ) {}
		bool operator==( const rectangle& rhs ) const {
			if( x != rhs.x ) return false;
			if( y != rhs.y ) return false;
			if( w != rhs.w ) return false;
			if( h != rhs.h ) return false;
			return true;
		}
		bool operator!=( const rectangle& rhs ) const {
			return !(*this == rhs);
		}
	};
	inline std::ostream& operator<<( std::ostream& os, const rectangle& r ) {
		os << "Rectangle [" << r.w << "x" << r.h;
		os << "+" << r.x << "+" << r.y << "]" << std::endl;
		return os;
	}
	
};

#endif

